package router

import (
	"fmt"
	"oc_saas/glo"
	"oc_saas/middleware"
	"oc_saas/router/admin"
	"oc_saas/router/share"

	"github.com/gin-gonic/gin"
)

func Router() {
	gin.ForceConsoleColor()
	r := gin.New()
	r.Use(middleware.CustomRecovery())
	r.Use(gin.Logger())
	r.GET("/text", func(c *gin.Context) { c.String(200, "健康") })
	var nr = r.Group(glo.OC_CONF.Server.Prefix)
	// 共享
	{
		share.BaseRouteGroup.InitBaseRouteGroup(nr) //基础路由
	}
	{
		admin.SystemRouteGroup.InitSystemGroup(nr) //系统路由
	}
	runPort := fmt.Sprintf(":%s", glo.OC_CONF.Server.Port)
	fmt.Printf("服务器运行端口:%s \n", runPort)
	r.Run(runPort)
}
